﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EC2011_hk1_BT8_1041074_1041130_1042119;

namespace Lab8_Security
{
    public partial class Admin : System.Web.UI.Page
    {
        public List<User> listUser = new List<User>();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"]!=null)
            {
                User u = (User)Session["UserLogin"];
                if (u.IdRole == 1)
                {
                    dbLab8DataContext db = new dbLab8DataContext();
                    var l = from r in db.Users select r;
                    listUser = l.ToList();
                }
            }
            else
            {
                Message.InnerHtml = Server.HtmlDecode("<b><i>You are not permission to access this page</i></b>");
            }
            
            //listUser = (List<User>)from r in db.Users select r;

        }
    }
}